/*
 * To change this license header, choose License Headers in Project Properties.
 * To change this template file, choose Tools | Templates
 * and open the template in the editor.
 */
package multiversiontechnicaldocumentation;

import java.io.BufferedWriter;
import java.io.FileNotFoundException;
import java.io.FileOutputStream;
import java.io.IOException;
import java.io.OutputStream;
import java.io.OutputStreamWriter;

public abstract class Writer {

    public static final String NEWLINE = "\r\n";
    public static final String DOCUMENT_VERSION_TIME_FORMAT = "yyyy-MM-dd HH:mm:ss";
    protected java.io.Writer out;

    public void open(String path) throws FileNotFoundException {
        OutputStream outputStream = new FileOutputStream(path);
        this.out = new BufferedWriter(new OutputStreamWriter(outputStream));
    }

    public void close() throws IOException {
        this.out.flush();
        this.out.close();
    }

    /**
     *
     * @param document
     * @throws IOException
     */
    public abstract void write(Document document) throws IOException;
}
